package com.x.Part7_枚举类.enumTest1;

/**
 * ClassName: Season
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.03.08 22:39
 */

interface Info{
    public abstract void getInfo();
}
public enum Season1 implements Info{

    //1、在枚举类的开头声明好对象，用逗号隔开
    SPRING("春天","立春"){
        //让对象有其独立的接口中的重写方法
        @Override
        public void getInfo() {
            System.out.println("春天在哪里");
        }
    },
    SUMMER("夏天","夏至"),
    FALL  ("秋天","立秋"),
    WINTER("冬天","冬至");

    //1、声明当前类实例对象的变量
    //final修饰的变量必须显式赋值
    private final String seasonName;
    private final String seasonDesc;


    //2、私有化构造器
    private Season1(String seasonName, String seasonDesc){
        this.seasonDesc=seasonDesc;
        this.seasonName=seasonName;
    }

    //3、提供get方法


    public String getSeasonName() {
        return seasonName;
    }

    public String getSeasonDesc() {
        return seasonDesc;
    }


    @Override
    public String toString() {
        return "Season1{" +
                "seasonName='" + seasonName + '\'' +
                ", seasonDesc='" + seasonDesc + '\'' +
                '}';
    }


    //枚举类重写接口方法
    @Override
    public void getInfo() {
        System.out.println("这个季节是" + seasonName);
    }
}
